
// 饿汉单例模式 - thread cache都找唯一一个central cache
class CentralCache
{
public:
    static CentralCache* GetInstance()
    {
        return &_sInst;
    }

    // 从中心缓存获取一定数量的内存对象给thread cache
    size_t FetchRangeObj(void*& start, void*& end, size_t batchNum, size_t size);

    // 从SpanList或者page cache获取一个非空的span
    Span* GetOneSpan(SpanList& list, size_t size);

    // 将一定数量的内存对象释放回span跨度
    void ReleaseListToSpan(void* start, size_t size);

private:
    SpanList _spanLists[NFREELISTS];

private:    
    CentralCache()
    {}

    CentralCache(const CentralCache&) = delete;

    static CentralCache _sInst;
};



